﻿@model QueuedEmailModel

@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.Id)

<div class="content">
    <div class="form-horizontal">
        <div class="panel-group">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.PriorityName)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFDisplayFor(model => model.PriorityName)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.From)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.From)
                            @Html.ValidationMessageFor(model => model.From)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.FromName)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.FromName)
                            @Html.ValidationMessageFor(model => model.FromName)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.To)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.To)
                            @Html.ValidationMessageFor(model => model.To)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.ToName)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.ToName)
                            @Html.ValidationMessageFor(model => model.ToName)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.ReplyTo)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.ReplyTo)
                            @Html.ValidationMessageFor(model => model.ReplyTo)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.ReplyToName)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.ReplyToName)
                            @Html.ValidationMessageFor(model => model.ReplyToName)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.CC)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.CC)
                            @Html.ValidationMessageFor(model => model.CC)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.Bcc)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.Bcc)
                            @Html.ValidationMessageFor(model => model.Bcc)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.Subject)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.Subject)
                            @Html.ValidationMessageFor(model => model.Subject)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.Body)
                        </div>
                        <div class="col-md-9">
                            @Html.EditorFor(model => model.Body, "RichEditor")
                            @Html.ValidationMessageFor(model => model.Body)
                        </div>
                    </div>
                    @if (!String.IsNullOrEmpty(Model.AttachmentFilePath))
                    {
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.SDFLabelFor(model => model.AttachmentFilePath)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFDisplayFor(model => model.AttachmentFilePath)
                            </div>
                        </div>
                    }
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.CreatedOn)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFDisplayFor(model => model.CreatedOn)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.SendImmediately)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.SendImmediately)
                            @Html.ValidationMessageFor(model => model.SendImmediately)
                        </div>
                    </div>
                    <div class="form-group" id="pnl-send-date">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.DontSendBeforeDate)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.DontSendBeforeDate)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.SentTries)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFEditorFor(model => model.SentTries)
                            @Html.ValidationMessageFor(model => model.SentTries)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.SentOn)
                        </div>
                        <div class="col-md-9">
                            @if (Model.SentOn.HasValue)
                            {
                                @Html.SDFDisplayFor(model => model.SentOn)
                            }
                            else
                            {
                                @T("Admin.System.QueuedEmails.Fields.SentOn.NotSent")
                            }
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-3">
                            @Html.SDFLabelFor(model => model.EmailAccountName)
                        </div>
                        <div class="col-md-9">
                            @Html.SDFDisplayFor(model => model.EmailAccountName)
                        </div>
                    </div>
                </div>

                <script type="text/javascript">
                    $(document).ready(function () {
                        $("#@Html.FieldIdFor(model => model.SendImmediately)").click(sendImmediately);
                        sendImmediately();
                    });

                    function sendImmediately() {
                        if ($('#@Html.FieldIdFor(model => model.SendImmediately)').is(':checked'))
                            $('#pnl-send-date').hide();
                        else
                            $('#pnl-send-date').show();
                    }
                </script>
            </div>
        </div>
    </div>
</div>